package com.boot.web.exception.handler;

import com.boot.web.exception.ModuleExceptionHandler;
import com.boot.web.http.HttpModel;
import com.boot.web.util.HttpResponseUtil;
import lombok.EqualsAndHashCode;
import org.springframework.http.ResponseEntity;

/**
 * @author 霜寒 <1621856595@qq.com>
 * @description 处理基本错误
 * @date 2020/2/16 20:25
 **/
@Deprecated
//@Component
@EqualsAndHashCode
public class BaseExceptionHandler implements ModuleExceptionHandler {

    @Override
    public boolean support(Exception e) {
        return true;
    }

    @Override
    public int order() {
        return 99;
    }

    @Override
    public ResponseEntity<HttpModel<Object>> handle(Exception e) {
        return HttpResponseUtil.badRequest(e.getMessage());
    }
}
